package com.journey.org.ui.home

import android.os.Bundle
import android.view.View
import com.journey.org.entity.BannerEntity
import com.journey.org.ui.video.broadcast.BroadcastActivity
import com.journey.org.ui.web.WebActivity
import com.mvvmhabit.org.base.ItemViewModel
import com.mvvmhabit.org.binding.command.BindingAction
import com.mvvmhabit.org.binding.command.BindingCommand

/**
 * @Date: 2020/11/17 15:32
 * @Author:小妖
 * @Description: ViewPager 的item
 */
class HomePagerItemViewModel(vm: HomeViewModel, val entity: BannerEntity) :
    ItemViewModel<HomeViewModel>(vm) {

    val onEnterDetailCommand = BindingCommand<Any>(object : BindingAction {
        override fun call() {
            val bundle = Bundle()
            bundle.putString("loadUrl", entity.url)
            bundle.putString("title", entity.title)
            viewModel.startActivity(WebActivity::class.java, bundle)
        }
    })
}